/*
 * @Author: huangtianyang 916072572@qq.com
 * @Date: 2023-11-27 10:04:45
 * @LastEditors: huangtianyang
 * @LastEditTime: 2024-04-02 10:36:11
 * @FilePath: \cxl-driving-training\src\apis\drivingSchool\index.ts
 */
import axios from '../../axios/index'

export interface drivingSchoolListInterface {
    current?: number
    size?: number
    disable?: number //0.可用；1.禁用
    fullName?: string //驾校全称
    qualification?: string //驾校资质
    shortName?: string
}

export interface describeInterface {
    msg?: string //描述
    tag?: string //标签
    cover?: string //视频封面url
    video?: string //视频url
    pic?: string //图片url
}

export interface passRateInfosInterface {
    id?: string
    recordDate?: number //yyyymm
    dateRank?: number //排名 类型1的时候不用传或给0
    schoolId?: string //驾校id
    subjectFourTotalPassRate?: number //科目四合格率
    subjectOnePassRate?: number //	科目一合格率
    subjectThreeTotalPassRate?: number //科目三合格率
    subjectTwoTotalPassRate?: number //科目二合格率
    totalPassRate?: number //综合合格率
    type?: number //类型(1.全市；2.驾校)
}

export interface drivingSchoolOperationInterface {
    advantage?: describeInterface[] //优势
    city?: string //所在城市
    cityId?: string //城市id
    developHistory?: describeInterface[] //发展历程
    fullName?: string //全称
    governmentQualification?: describeInterface[] //政府资质
    honor?: describeInterface[] //所获荣誉
    id?: string
    logo?: string //驾校logo
    motto?: string //校训
    passRateInfos?: passRateInfosInterface[] //	驾校合格率，注意，这里是2条数据 1条是全市的，1条是驾校合格率
    qualification?: string //资质
    qualificationPic?: describeInterface[] //资质图片
    schoolPic?: describeInterface[] //驾校图片
    shortName?: string //简称
    tag?: string[] //标签
    details?: string //驾校详情
    schoolScale?: describeInterface[] //规模和说明
    schoolVideo?: describeInterface[] //驾校视频
    styleInfo?: string //驾校风格
    customerServiceTel: string
    customerServiceUrl: string
    homeLogo: string
    loginLogo: string
}

//列表获取
export const drivingSchoolList = (params: drivingSchoolListInterface) => {
    return axios({
        method: 'get',
        url: '/api/system/school/manage/getPageList',
        params
    })
}

//新增驾校
export const drivingSchoolAdd = (data: drivingSchoolOperationInterface) => {
    return axios({
        method: 'post',
        url: '/api/system/school/manage/add',
        data
    })
}

//编辑驾校信息
export const drivingSchoolEdit = (data: drivingSchoolOperationInterface) => {
    return axios({
        method: 'post',
        url: '/api/system/school/manage/edit',
        data
    })
}

//获取单个驾校信息
export const drivingSchoolDetailed = (id: string) => {
    return axios({
        method: 'get',
        url: '/api/system/school/manage/getDetailById',
        params: { id }
    })
}
//驾校列表
export const drivingSchoolSimpleList = () => {
    return axios({
        method: 'get',
        url: '/api/system/school/manage/getList'
    })
}

//驾校启用禁用  disable	0.可用；1.禁用
export const drivingSchoolDisable = (disable: number, id: string) => {
    return axios({
        method: 'post',
        url: '/api/system/school/manage/updateDisable',
        data: { disable, id }
    })
}
